//
//  ProjectCell.m
//  IpadTestB
//
//  Created by edianzu on 2017/7/6.
//  Copyright © 2017年 ruilai. All rights reserved.
//

#import "ProjectCell.h"

@implementation ProjectCell

/*p
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    return self;
}

-(void)createUI{
    self.contentView.backgroundColor = [UIColor whiteColor];
    self.label = [[UILabel alloc]init];
    self.label.textColor = UIColorFromRGB(138, 138, 138);
    self.label.font = [UIFont systemFontOfSize:18*AutoScaleHorizontal];
    [self.label setTextAlignment:NSTextAlignmentCenter];
    //    self.label.text = @"全选";
    [self.contentView addSubview:self.label];
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(180*AutoScaleHorizontal, 25*AutoScaleVertical));
    }];
    
    self.coverBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.coverBtn.backgroundColor = [UIColor clearColor];
    [self.coverBtn addTarget:self action:@selector(pressCover) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.coverBtn];
    [self.coverBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.bottom.mas_equalTo(self.contentView);
    }];
    
}
-(void)pressCover{
    NSLog(@"cover");
        self.callChange(@"1");
}

-(void)relayoutCellWithModel:(DetailListModel*)model{
    self.label.text = model.Name;
    if ([model.isSelected isEqualToString:@"1"]) {
        self.contentView.backgroundColor = UIColorFromRGB(26, 167, 157);
        self.label.font = [UIFont systemFontOfSize:23*AutoScaleHorizontal];
        self.label.textColor = [UIColor whiteColor];
        
    }else{
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.label.textColor = UIColorFromRGB(138, 138, 138);
        self.label.font = [UIFont systemFontOfSize:18*AutoScaleHorizontal];
    }
}
@end


















